// 大屏适配组件统一导出
import ScreenAdapterComponent from "./index.vue";
import {
  ScreenAdapter,
  screenUtils,
  ScreenAdapterPlugin,
  useScreenAdapter,
  globalScreenAdapter,
} from "./utils/screenAdapter.js";

// 主组件
export default ScreenAdapterComponent;

// 命名导出
export { ScreenAdapterComponent, ScreenAdapter, screenUtils, useScreenAdapter };

// 工具类和工具函数
export { ScreenAdapter, screenUtils, ScreenAdapterPlugin, useScreenAdapter, globalScreenAdapter };

// Vue 插件安装
export function install(app, options = {}) {
  // 注册组件
  app.component("ScreenAdapter", ScreenAdapterComponent);

  // 注册全局属性
  app.config.globalProperties.$screenAdapter = new ScreenAdapter(options);
  app.config.globalProperties.$screenUtils = screenUtils;

  // 提供inject key
  app.provide("screenAdapter", new ScreenAdapter(options));
  app.provide("screenUtils", screenUtils);
}

// 自动安装（如果是通过 script 标签引入）
if (typeof window !== "undefined" && window.Vue) {
  install(window.Vue);
}

// 版本信息
export const version = "1.2.0";
